package com.svndiffdoc;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class AnnotatedFileLine {
    private Date date;
    private long revision;
    private String author;
    private long lineNumber;
    private String line;
    private String messageLog;
    private boolean isMatchPoint;
    private String lineClass;
    private List<AnnotatedFileLineFragment> lineFragments;

    public AnnotatedFileLine(Date date, long revision, String author, long lineNumber, String line) {
        this.date = date;
        this.revision = revision;
        this.author = author;
        this.lineNumber = lineNumber;
        this.line = line;
        this.lineFragments = new ArrayList<AnnotatedFileLineFragment>();
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public long getRevision() {
        return revision;
    }

    public void setRevision(long revision) {
        this.revision = revision;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public long getLineNumber() {
        return lineNumber;
    }

    public void setLineNumber(long lineNumber) {
        this.lineNumber = lineNumber;
    }

    public String getLine() {
        return line;
    }

    public void setLine(String line) {
        this.line = line;
    }

    public String getMessageLog() {
        return messageLog;
    }

    public void setMessageLog(String messageLog) {
        this.messageLog = messageLog;
    }

    public String getLineClass() {
        return lineClass;
    }

    public void setLineClass(String lineClass) {
        this.lineClass = lineClass;
    }

    public boolean isMatchPoint() {
        return isMatchPoint;
    }

    public void setMatchPoint(boolean isMatchPoint) {
        this.isMatchPoint = isMatchPoint;
    }

    public List<AnnotatedFileLineFragment> getLineFragments() {
        return lineFragments;
    }

    public void setLineFragments(List<AnnotatedFileLineFragment> lineFragments) {
        this.lineFragments = lineFragments;
    }

    @Override
    public int hashCode() {
        if (line != null) {
            return line.hashCode();
        }
        return 1;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj instanceof AnnotatedFileLine) {
            return line.equals(((AnnotatedFileLine)obj).getLine());
        }
        return false;
    }

}
